<template>
  <div>
    <form @submit.prevent="addForm">
      <table border="1" align="center">
        <tr>
          <td>员工姓名</td><td><input type="text" v-model="emp.name"/></td>
        </tr>
        <tr>
          <td>员工年龄</td><td><input type="text" v-model="emp.age"/></td>
        </tr>
        <tr>
          <td>员工地址</td><td><input type="text" v-model="emp.address"/></td>
        </tr>
        <tr>
          <td>员工介绍</td><td><textarea rows="5" cols="50" v-model="emp.content"></textarea></td>
        </tr>
        <tr>
          <td colspan="2"><button>新增</button></td>
        </tr>
      </table>
    </form>
  </div>
</template>
<script>
export default {
  name: 'empForm',
  data () {
    return {
      emp: {}
    }
  },
  
  methods:{
    addForm:function(){
        this.axios.post("/emps",this.emp).then(
          resp=>{
            if(resp.status==200){
              this.$router.push("/");
            }
          }
        );
    }
  }
}
</script>